<?php

namespace App\Http\Resources\Activity\B;

use App\Http\Resources\BaseResource;
use App\Models\Activity\ActivityActionModel;
use Illuminate\Http\Request;

class ActivityActionDetailResource extends BaseResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            "id"                          => $this->id,
            "activityId"                  => $this->activityId,
            "actionType"                  => $this->actionType,
            "actionTypeText"              => ActivityActionModel::ACTION_TYPE_TEXT[$this->actionType] ?? "",
            "name"                        => $this->name,
            "remark"                      => $this->remark,
            "price"                       => $this->price,
            "originalPrice"               => $this->originalPrice,
            "goodsId"                     => $this->goodsId,
            "goodsNum"                    => $this->goodsNum,
            "goodsInfo"                   => jsonToArr($this->goodsInfo, []),
            "shippingAddressSwitch"       => $this->shippingAddressSwitch,
            "shippingAddressType"         => $this->shippingAddressType,
            "shippingAddressTypeText"     => ActivityActionModel::SHIPPING_ADDRESS_TEXT[$this->shippingAddressType] ?? "",
            "formTemplateId"              => $this->formTemplateId,
            "examineSwitch"               => $this->examineSwitch,
            "examineUser"                 => jsonToArr($this->examineUser, []),
            "groupNotificationBotName"    => $this->groupNotificationBotName,
            "groupNotificationBotWebhook" => $this->groupNotificationBotWebhook,
            "groupNotificationBotSecret"  => $this->groupNotificationBotSecret,
            "sort"                        => $this->sort,
            "hiddenSwitch"                => $this->hiddenSwitch,
        ];
    }
}
